$(function () {
    fetchData();

    $("#btnSearch").click(function () {
        $('#tb').bootstrapTable("refresh",{
            pageNumber:1
        })
    })
});

function fetchData() {
    $('#tb').bootstrapTable({
        method:'get',
        url:'/recordin/Search',
        pagination:true,
        pageNumber:1,
        pageSize:5,
        pageList:[5,10,20,30,50,100],
        sidePagination: "server",
        queryParamsType:"page",
        queryParams:function (params) {
            params["goodName"] = $("#goodName").val();
            params["supplierName"] = $("#supplierName").val();
            let register_date_MIN = $("#inRecordTime").val();
            let register_date_Max = $("#outRecordTime").val();
            if (register_date_MIN.trim().length>0 && register_date_Max.trim().length>0){
                params["inRecordTime"] = register_date_MIN;
                params["outRecordTime"] = register_date_Max;
            }
            return params;
        },
        clickToSelect:true,

        //配置表格显示的列以及数据
        columns:[
            {
                title:'入库单号',
                field:'recordId'
            },
            {
                title:'仓库地址',
                field:'repoAddress'
            },
            {
                title:'商品名称',
                field:'goodName'
            },
            {
                title:'供应商名称',
                field:'supplierName'
            },
            {
                title:'商品数量',
                field:'recordNumber'
            },
            {
                title:'入库时间',
                field:'recordTime'
            },
        ],
        responseHandler:function (res) {
            if(res.code===1){
                res = res.data;
            }
            return res;
        }
    });
}

